﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using TFSAdministrationTool.Proxy.Common;

namespace TFSAdministrationTool
{
  public partial class SystemAvailability : Form
  {
    private SiteStatus spStatus;
    private SiteStatus rsStatus;

    public SystemAvailability(SiteStatus sharePointStatus, SiteStatus reportingServicesStatus)
    {
      InitializeComponent();

      spStatus = sharePointStatus;
      rsStatus = reportingServicesStatus;
    }

    private void SystemAvailability_Load(object sender, EventArgs e)
    {
      lblSharePointStatus.Text = Enum.GetName(typeof(SiteStatus), spStatus);
      lblReportingServicesStatus.Text = Enum.GetName(typeof(SiteStatus), spStatus);

      pbSharePointGood.Visible = spStatus == SiteStatus.Available;
      pbSharePointBad.Visible = spStatus != SiteStatus.Available;

      pbReportingServicesGood.Visible = rsStatus == SiteStatus.Available;
      pbReportingServicesBad.Visible = rsStatus != SiteStatus.Available;
    
      cbSupressWarnings.Checked = !Properties.Settings.Default.PromptForSystemAvaiablity;
    }

    private void btnOK_Click(object sender, EventArgs e)
    {
      if (cbSupressWarnings.Checked)
      {
        Properties.Settings.Default.PromptForSystemAvaiablity = !cbSupressWarnings.Checked;
        Properties.Settings.Default.Save();
      }
    }
  }
}